/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * GradesUI.java
 *
 * Created on 11 1, 11, 5:10:50 PM
 */
package introsemp;

import javax.swing.*;

/**
 *
 * @author Marit
 */
public class GradesUI extends javax.swing.JPanel {

    /** Creates new form GradesUI */
    JFrame frame;
    int usertype;
    public GradesUI(int usertype) {
        initComponents();
        JLabel bg = new JLabel();
        this.usertype = usertype;
        if (usertype==0)
            bg.setIcon(new ImageIcon("Images\\class records.png"));
        
        if (usertype==3) {
            bg.setIcon(new ImageIcon("Images\\asstprincipalMainMenu.png"));
            Button2.setEnabled(false);
            Button3.setEnabled(false);
            Button4.setEnabled(false);
            attendance.setVisible(false);
            jLabel4.setVisible(false);
        }
        
        bg.setSize(930, 686);
        add(bg);
        bg.setVisible(true);
    }

    
public void setFrame(JFrame frame) {
    this.frame = frame;
    frame.add(this);
    frame.validate();
    frame.setSize(930, 686);
}
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        addActivity = new javax.swing.JButton();
        editActivity = new javax.swing.JButton();
        enterScores = new javax.swing.JButton();
        searchBar = new javax.swing.JTextField();
        jButton1 = new javax.swing.JButton();
        jScrollPane1 = new javax.swing.JScrollPane();
        jTable1 = new javax.swing.JTable();
        jComboBox1 = new javax.swing.JComboBox();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jComboBox2 = new javax.swing.JComboBox();
        jButton2 = new javax.swing.JButton();
        jButton4 = new javax.swing.JButton();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        attendance = new javax.swing.JButton();
        Button2 = new javax.swing.JButton();
        Button3 = new javax.swing.JButton();
        Button4 = new javax.swing.JButton();
        logoutButton = new javax.swing.JButton();

        setBackground(new java.awt.Color(255, 255, 255));
        setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));

        addActivity.setFont(new java.awt.Font("Segoe UI", 0, 13));
        addActivity.setIcon(new javax.swing.ImageIcon(getClass().getResource("/introsemp/add.png"))); // NOI18N
        addActivity.setText("Add Activity");
        addActivity.setFocusPainted(false);
        addActivity.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                addActivityActionPerformed(evt);
            }
        });

        editActivity.setFont(new java.awt.Font("Segoe UI", 0, 13));
        editActivity.setIcon(new javax.swing.ImageIcon(getClass().getResource("/introsemp/edit.png"))); // NOI18N
        editActivity.setText("Edit Activity");
        editActivity.setFocusPainted(false);
        editActivity.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                editActivityActionPerformed(evt);
            }
        });

        enterScores.setFont(new java.awt.Font("Segoe UI", 0, 13));
        enterScores.setIcon(new javax.swing.ImageIcon(getClass().getResource("/introsemp/save.png"))); // NOI18N
        enterScores.setText("Save Changes");
        enterScores.setFocusPainted(false);
        enterScores.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseReleased(java.awt.event.MouseEvent evt) {
                enterScoresMouseReleased(evt);
            }
        });
        enterScores.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                enterScoresActionPerformed(evt);
            }
        });

        searchBar.setFont(new java.awt.Font("Segoe UI", 0, 13));

        jButton1.setFont(new java.awt.Font("Segoe UI", 0, 13));
        jButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/introsemp/search.png"))); // NOI18N
        jButton1.setText("Search");
        jButton1.setFocusPainted(false);

        jTable1.setFont(new java.awt.Font("Segoe UI", 0, 13));
        jTable1.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Name", "SW 1", "SW 2", "HW 1"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.String.class, java.lang.Float.class, java.lang.Float.class, java.lang.Float.class
            };
            boolean[] canEdit = new boolean [] {
                false, true, true, true
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        jTable1.setRowHeight(20);
        jTable1.getTableHeader().setReorderingAllowed(false);
        jScrollPane1.setViewportView(jTable1);

        jComboBox1.setFont(new java.awt.Font("Segoe UI", 0, 13));
        jComboBox1.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "1 - Wisdom (English)", "2 - Piety (English)", "3 - Justice (Science)", "4 - Perseverance (Filipino)" }));
        jComboBox1.setOpaque(false);

        jLabel1.setFont(new java.awt.Font("Segoe UI", 0, 13));
        jLabel1.setForeground(new java.awt.Color(51, 51, 51));
        jLabel1.setText("Section:");

        jLabel2.setFont(new java.awt.Font("Segoe UI", 0, 13)); // NOI18N
        jLabel2.setForeground(new java.awt.Color(51, 51, 51));
        jLabel2.setText("Grading:");

        jComboBox2.setFont(new java.awt.Font("Segoe UI", 0, 13)); // NOI18N
        jComboBox2.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "1st", "2nd", "3rd", "Final" }));

        jButton2.setFont(new java.awt.Font("Segoe UI", 0, 13));
        jButton2.setForeground(new java.awt.Color(255, 102, 0));
        jButton2.setText("Academics");
        jButton2.setContentAreaFilled(false);
        jButton2.setEnabled(false);
        jButton2.setFocusPainted(false);

        jButton4.setFont(new java.awt.Font("Segoe UI", 0, 13)); // NOI18N
        jButton4.setText("Conduct");
        jButton4.setContentAreaFilled(false);
        jButton4.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        jButton4.setFocusPainted(false);
        jButton4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton4ActionPerformed(evt);
            }
        });

        jLabel3.setFont(new java.awt.Font("Simplified Arabic Fixed", 0, 36));
        jLabel3.setText("|");

        jLabel4.setFont(new java.awt.Font("Simplified Arabic Fixed", 0, 36)); // NOI18N
        jLabel4.setText("|");

        attendance.setFont(new java.awt.Font("Segoe UI", 0, 13)); // NOI18N
        attendance.setText("Attendance");
        attendance.setContentAreaFilled(false);
        attendance.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        attendance.setFocusPainted(false);
        attendance.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                attendanceActionPerformed(evt);
            }
        });

        Button2.setContentAreaFilled(false);
        Button2.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        Button2.setFocusPainted(false);
        Button2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                Button2ActionPerformed(evt);
            }
        });

        Button3.setContentAreaFilled(false);
        Button3.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        Button3.setFocusPainted(false);
        Button3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                Button3ActionPerformed(evt);
            }
        });

        Button4.setContentAreaFilled(false);
        Button4.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        Button4.setFocusPainted(false);
        Button4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                Button4ActionPerformed(evt);
            }
        });

        logoutButton.setFont(new java.awt.Font("Verdana", 0, 13)); // NOI18N
        logoutButton.setText("Log out");
        logoutButton.setContentAreaFilled(false);
        logoutButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                logoutButtonActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(42, 42, 42)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(Button4, javax.swing.GroupLayout.DEFAULT_SIZE, 156, Short.MAX_VALUE)
                            .addComponent(Button3, javax.swing.GroupLayout.DEFAULT_SIZE, 156, Short.MAX_VALUE)
                            .addComponent(Button2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 156, Short.MAX_VALUE))
                        .addGap(76, 76, 76))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(65, 65, 65)
                        .addComponent(logoutButton)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)))
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(360, 360, 360)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addGap(90, 90, 90)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jLabel3)
                                    .addGroup(layout.createSequentialGroup()
                                        .addGap(10, 10, 10)
                                        .addComponent(jButton4)))
                                .addGap(2, 2, 2)
                                .addComponent(attendance))
                            .addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(layout.createSequentialGroup()
                                .addGap(170, 170, 170)
                                .addComponent(jLabel4))))
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 630, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(addActivity, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(20, 20, 20)
                        .addComponent(editActivity, javax.swing.GroupLayout.PREFERRED_SIZE, 190, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(20, 20, 20)
                        .addComponent(enterScores, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, 180, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel1))
                        .addGap(20, 20, 20)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel2)
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(jComboBox2, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(20, 20, 20)
                                .addComponent(searchBar, javax.swing.GroupLayout.PREFERRED_SIZE, 231, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jButton1)))))
                .addGap(23, 23, 23))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap(135, Short.MAX_VALUE)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jButton4)
                    .addComponent(attendance)
                    .addComponent(jButton2)
                    .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(10, 10, 10)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 389, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(11, 11, 11)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel1)
                    .addComponent(jLabel2))
                .addGap(4, 4, 4)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jComboBox2, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(searchBar, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(10, 10, 10)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(addActivity)
                    .addComponent(editActivity)
                    .addComponent(enterScores))
                .addGap(23, 23, 23))
            .addGroup(layout.createSequentialGroup()
                .addGap(199, 199, 199)
                .addComponent(Button2, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(Button3, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(Button4, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 364, Short.MAX_VALUE)
                .addComponent(logoutButton))
        );
    }// </editor-fold>//GEN-END:initComponents

private void addActivityActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addActivityActionPerformed
    ActivityUI act = new ActivityUI();
    act.addActivity();// TODO add your handling code here:
}//GEN-LAST:event_addActivityActionPerformed

private void editActivityActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_editActivityActionPerformed
    ActivityUI act = new ActivityUI();
    act.editActivity();// TODO add your handling code here:
}//GEN-LAST:event_editActivityActionPerformed

private void enterScoresActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_enterScoresActionPerformed
    JDialog dbox = new JDialog();
    dbox.setSize(400,250);

    int response = JOptionPane.showConfirmDialog(
                    dbox, "Are you sure you want to save changes?", " ", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE);
            if (response != JOptionPane.YES_OPTION ) {
                dbox.dispose();
            } else if (response == JOptionPane.YES_OPTION ) {
                dbox.dispose();
            }
}//GEN-LAST:event_enterScoresActionPerformed

private void enterScoresMouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_enterScoresMouseReleased
// TODO add your handling code here:
}//GEN-LAST:event_enterScoresMouseReleased

private void attendanceActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_attendanceActionPerformed
    remove();
    AttendanceUI a = new AttendanceUI();
    a.setFrame(frame);// TODO add your handling code here:
}//GEN-LAST:event_attendanceActionPerformed

private void Button2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_Button2ActionPerformed
    remove();
    GradeBreakdownUI a = new GradeBreakdownUI(0);
    a.setFrame(frame);
    // TODO add your handling code here:
}//GEN-LAST:event_Button2ActionPerformed

private void Button3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_Button3ActionPerformed
    remove();
    ClassUI c = new ClassUI();
    c.setFrame(frame);// TODO add your handling code here:
}//GEN-LAST:event_Button3ActionPerformed

private void Button4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_Button4ActionPerformed
    remove();
    ComponentsUI com = new ComponentsUI(0);
    com.setFrame(frame);// TODO add your handling code here:
}//GEN-LAST:event_Button4ActionPerformed

private void logoutButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_logoutButtonActionPerformed
    JDialog dbox = new JDialog();
    dbox.setSize(400,250);
    int response = JOptionPane.showConfirmDialog(
                    dbox, "Are you sure you want to log out?", " ", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE);
            if (response == JOptionPane.YES_OPTION ) {
                dbox.dispose();
                System.exit(0);
            } else if (response == JOptionPane.NO_OPTION ) {
                dbox.dispose();
            }    // TODO add your handling code here:
}//GEN-LAST:event_logoutButtonActionPerformed

private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed
        JDialog dbox = new JDialog();
    JOptionPane.showMessageDialog(dbox,"Function is not yet available.\n"+" ");// TODO add your handling code here:
}//GEN-LAST:event_jButton4ActionPerformed

public void remove() {
    frame.remove(this);
}
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton Button2;
    private javax.swing.JButton Button3;
    private javax.swing.JButton Button4;
    private javax.swing.JButton addActivity;
    private javax.swing.JButton attendance;
    private javax.swing.JButton editActivity;
    private javax.swing.JButton enterScores;
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton2;
    private javax.swing.JButton jButton4;
    private javax.swing.JComboBox jComboBox1;
    private javax.swing.JComboBox jComboBox2;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JTable jTable1;
    private javax.swing.JButton logoutButton;
    private javax.swing.JTextField searchBar;
    // End of variables declaration//GEN-END:variables
}
